package apptoko.com;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import apptoko.com.util.Constants;
import apptoko.com.util.Utils;

import apptoko.com.R;


public class ShowCompleteDownloadData extends Activity {
	

	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.download_complete_data);
		initView();
	}

	protected void initView() {
		// TODO Auto-generated method stub
		if(getIntent().hasExtra("appinfo"))
		{
			TextView info=(TextView) findViewById(R.id.appinfo);
			info.setText(getIntent().getStringExtra("appinfo"));
		}
		final boolean isInstalled=getIntent().getBooleanExtra("isInstalled", false);
		final String _package=getIntent().getStringExtra("package");
		Button gotoManage=(Button)findViewById(R.id.btn_open_manager);
		gotoManage.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if(isInstalled){
					Utils.launch(ShowCompleteDownloadData.this, _package);
				}else{
					Intent intent=new Intent(ShowCompleteDownloadData.this, AppManageActivity.class);
					intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
					intent.putExtra(Constants.STORE_KEY, "apps");
					startActivity(intent);
				}
				finish();
			}
		});
		
	}
}
